/*
 * @Author: wuqingchun
 * @Date: 2024-10-14 15:35:49
 * @Description: 
 * @LastEditors: wuqingchun
 * @LastEditTime: 2024-10-16 09:52:27
 */
#include <cstring>
#include <thread>

#include "redis_client.h"

const char* g_pcRedisServer = "127.0.0.1";
uint16_t g_usRedisPort = 6379;

int main(int argc, char** argv)
{
    CRedisClient objClient;

    int32_t iErr = objClient.Start(g_pcRedisServer, g_usRedisPort);
    if (iErr != 0)
    {
        return 0;
    }

    tick stTick;

    stTick.tradingday = 20241014;
    stTick.time = 204830;
    stTick.milli = 500;
    (void)strcpy(stTick.instrument_id, "a2411");
    stTick.last_price = 100.2;
    while (true)
    {
        stTick.time++;
        stTick.volume++;
        objClient.PushMarketData(stTick);
        std::this_thread::sleep_for(std::chrono::seconds(1));

        objClient.GetLatestMarketData(stTick);
    }

    objClient.Stop();

    return 0;
}